package cn.doit.scala.day04

import scala.collection.parallel.immutable.ParSeq

/**
 * @DATE 2021/12/28/15:13
 * @Author MDK
 * @Version 2021.2.2
 * */
object C15_Aggregate {
  def main(args: Array[String]): Unit = {
    val list: List[Int] = List[Int](1, 2, 3, 4, 5)
    val res: Int = list.aggregate(10)(_ + _, _ + _)
    println(res)

    //集合并行化处理
    val par: ParSeq[Int] = list.par
    val res2 = par.aggregate(10)(_ * _, _ + _)
    println(res2)
  }
}
